<template>
    <view class="school">
        <view class="school-item" v-for="item in schoolList" :key="item.id" @click="handleItemClick(item)">
            {{ item.schoolName }}
        </view>
    </view>
</template>

<script setup>

import { listSchool } from '@/api/org.js'

import { goBack } from '@/utils/app'

onMounted(() => {
    listSchoolReq()
})

const schoolList = ref([])
const listSchoolReq = async () => {
    const res = await listSchool()
    const data = res.data || []
    schoolList.value = data
}

const handleItemClick = (item) => {
    uni.$emit('__selectSchool__',item)
    goBack()
}

</script>

<style scoped lang="scss">
.school {
    margin-top: 24rpx;
    display: flex;
    flex-direction: column;

    .school-item {
        padding: 24rpx 24rpx;
        color: #1d2129;
        font-family: PingFang SC;
        font-weight: 500;
        font-size: 32rpx;
        background: #fff;
        border-bottom: 1rpx solid #efeff4;
    }
    .school-item:last-child {
        border-bottom: none;
      }
}
</style>